<script>
    (function($) {        
        $(document).ready( function() {
            $("#member_type").val($("#target_type").val());
            targetTypeHandler();

            $('a.captcha_image').click(function(e) {            
                $.post(
                    base_url + "index.php/member/captcha",
                    function(data) {                    
                        $('#captcha_word').val(data.word);
                        $('#captcha_image').empty();
                        $('#captcha_image').prepend(data.image);
                    },
                    'json');

                e.preventDefault();
            });
            
            $("#member_type").change(function(e) {
                targetTypeHandler();
            });
        });
    })(jQuery);
    
    function targetTypeHandler() {
        var member_type = $("#member_type").val();
        if (member_type == '') {
            $(".non_vendor").hide("slow");
            $(".vendor").hide("slow");
        }
        else if (member_type == 3) {
            $(".non_vendor").hide("slow");
            $(".vendor").show("slow");
        }
        else {
            $(".non_vendor").show("slow");
            $(".vendor").hide("slow");
        }        
    }
</script>
<div id="content">
    <div class="container_medium">
        <div class="information">
<?php 
            if(isset($message_title))
                echo '<h1 class="blue">' . $message_title . '</h1>';

            if(isset($message_body))
                echo '<h2 class="orange">' . $message_body . '</h2>';
?>            
        </div>
        <div>
<?php            
        $attributes = array(
            'class' => 'email', 
            'id' => 'targets');         
        echo form_open_multipart(
            base_url() . "index.php/member/resetpassword/" . (isset($token) ? $token : ""), 
            $attributes );
        
if($step == 0) {
?>            
            <p>
                <span class="mandatory">E-mail address</span>
            </p>
            <p>
                <input type="hidden" name="step" value="1" />
                <input type="text" name="email" value="" id="email" class="mandatory_email" />
            </p>
            <p>
                <span class="mandatory">Image verification</span>
            </p>            
            <div id="captcha_image">
<?php 
            echo $captcha['image'];
?>                    
            </div>            
            <p>
                <br>
                <input type='hidden' id='captcha_word' value='<?php echo $_SESSION['captchaWord']; ?>' >
                <input style="width: 224px;" type="text" id="confirm_captcha" value="" class="mandatory_captcha">
                <a class="captcha_image" href="#">
                    <img style="vertical-align: middle;" alt="Captcha" title="Request new code" src="<?php echo base_url(); ?>system/public/img/refresh.png" />
                </a>                
            </p>
            <p>
                <input type="submit" value="Submit" name="submit" class="register" />
            </p>
<?php
}
else if($step == 2) {
?>
            <p>
                <span class="mandatory">E-mail address</span>
            </p>
            <p>                
                <input type="hidden" name="step" value="3" />                
                <input type="text" name="email" value="<?php echo $email; ?>" id="email" class="mandatory_email" disabled />
            </p>
            <p>                
                <span class="mandatory">Password [6-20 characters (A-Z, a-z, 0-9)]</span>
            </p>
            <p>                
                <input type="password" name="password" value="" id="password" class="mandatory_password" style="width: 252px;" />
            </p>
            <p>                
                <span class="mandatory">Re-type password</span>
            </p>
            <p>                
                <input type="password" class="mandatory_password" style="width: 252px;" id="confirm_password">
            </p>
            <p>
                <input type="submit" value="Submit" name="submit" class="register" />
            </p>            
<?php
}
        echo form_close() 
?>            
        </div>
    </div>
    <div class="quicklink">
<?php 
        $this->load->view('/templates/quicklinks');
?>            
    </div>    
</div>
<div class="separator"></div>